package cn.zmwh.bbs.modules.bbs.controller;


import cn.zmwh.bbs.modules.bbs.pojo.entity.ForumComment;
import cn.zmwh.bbs.modules.bbs.pojo.vo.CommentListRequest;
import cn.zmwh.bbs.modules.bbs.service.ForumCommentService;
import cn.zmwh.common.core.api.Result;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

/**
 * <p>
 * 评论 前端控制器
 * </p>
 *
 * @author dmzmwh
 * @since 2025-07-18
 */
@RestController
@RequestMapping("/bbs/forum/comment")
public class ForumCommentController {

    @Autowired
    private ForumCommentService forumCommentService;

    @GetMapping
    public Result list(CommentListRequest request) {
        IPage<ForumComment> page = forumCommentService.page(request, Wrappers.<ForumComment>lambdaQuery()
                .eq(ForumComment::getArticleNo, request.getArticleNo()));

        return Result.pageOk(page.getRecords(), page.getTotal());
    }

}

